using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using SdlDotNet.Audio;

namespace ElteIk.RoboSoccer.SDL
{
    public class SdlAudioEngine : AudioEngine
    {
        private SoundDictionary sounds = new SoundDictionary();

        public SdlAudioEngine()
        {
            instance = this;
        }

        public override AudioEngine CreateInstance()
        {
            return new SdlAudioEngine();
        }

        public override void AddSound( string soundName, string filename )
        {
            if ( !File.Exists( filename ) )
                throw new AudioException("Sound file '" + filename + "' does not exist!");

            sounds[soundName] = new Sound(filename);
        }

        public override void PlaySound(string soundName, bool loopable)
        {
            sounds[soundName].Play(loopable);
        }
    }
}
